home *** CD-ROM | disk | FTP | other *** search
/ Practical Algorithms for Image Analysis / Practical Algorithms for Image Analysis.iso / TARFILE.GZ / tarfile / ch_5.7 / xsgll / testsegm.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-09-11  |  3.1 KB  |  117 lines

  1. /* 
  2.  * testsegm.c
  3.  * 
  4.  * Practical Algorithms for Image Analysis
  5.  * 
  6.  * Copyright (c) 1997, 1998, 1999 MLMSoftwareGroup, LLC
  7.  */
  8.  
  9. /*
  10.  * TESTSEGM
  11.  *
  12.  * initialize 11 test segments for xllist.c, xsall.c
  13.  * (LRM horizontal and vertical test segments)
  14.  *
  15.  * ms, 11/90;
  16.  */
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19.  
  20. #include "lldef.h"
  21. #include "xsgll.h"
  22.  
  23.  
  24.  
  25.  
  26. void
  27. init_testsegm (testsegm, n_segm)
  28.      struct Segm *testsegm;
  29.      int n_segm;
  30. {
  31.  
  32.   if (n_segm != 11) {
  33.     printf ("\n...TOTAL_SEG must equal 11 in this test routine\n");
  34.     exit (1);
  35.   }
  36.  
  37. /* nearly horizontal or nearly vertical segm */
  38.  
  39.   (testsegm + 0)->ptO.x = 336;
  40.   (testsegm + 0)->ptO.y = 174;
  41.   (testsegm + 0)->ptF.x = 336;
  42.   (testsegm + 0)->ptF.y = 275;
  43.   (testsegm + 0)->slope = fslope ((testsegm + 0)->ptO, (testsegm + 0)->ptF);
  44.   (testsegm + 0)->line_ind = 0;
  45.  
  46.   (testsegm + 1)->ptO.x = 364;
  47.   (testsegm + 1)->ptO.y = 174;
  48.   (testsegm + 1)->ptF.x = 364;
  49.   (testsegm + 1)->ptF.y = 275;
  50.   (testsegm + 1)->slope = fslope ((testsegm + 1)->ptO, (testsegm + 1)->ptF);
  51.   (testsegm + 1)->line_ind = 1;
  52.  
  53.   (testsegm + 2)->ptO.x = 393;
  54.   (testsegm + 2)->ptO.y = 174;
  55.   (testsegm + 2)->ptF.x = 393;
  56.   (testsegm + 2)->ptF.y = 275;
  57.   (testsegm + 2)->slope = fslope ((testsegm + 2)->ptO, (testsegm + 2)->ptF);
  58.   (testsegm + 2)->line_ind = 2;
  59.  
  60.   (testsegm + 3)->ptO.x = 96;
  61.   (testsegm + 3)->ptO.y = 187;
  62.   (testsegm + 3)->ptF.x = 162;
  63.   (testsegm + 3)->ptF.y = 187;
  64.   (testsegm + 3)->slope = fslope ((testsegm + 3)->ptO, (testsegm + 3)->ptF);
  65.   (testsegm + 3)->line_ind = 3;
  66.  
  67.   (testsegm + 4)->ptO.x = 289;
  68.   (testsegm + 4)->ptO.y = 195;
  69.   (testsegm + 4)->ptF.x = 289;
  70.   (testsegm + 4)->ptF.y = 299;
  71.   (testsegm + 4)->slope = fslope ((testsegm + 4)->ptO, (testsegm + 4)->ptF);
  72.   (testsegm + 4)->line_ind = 4;
  73.  
  74.   (testsegm + 5)->ptO.x = 313;
  75.   (testsegm + 5)->ptO.y = 195;
  76.   (testsegm + 5)->ptF.x = 313;
  77.   (testsegm + 5)->ptF.y = 299;
  78.   (testsegm + 5)->slope = fslope ((testsegm + 5)->ptO, (testsegm + 5)->ptF);
  79.   (testsegm + 5)->line_ind = 5;
  80.  
  81.   (testsegm + 6)->ptO.x = 264;
  82.   (testsegm + 6)->ptO.y = 196;
  83.   (testsegm + 6)->ptF.x = 264;
  84.   (testsegm + 6)->ptF.y = 302;
  85.   (testsegm + 6)->slope = fslope ((testsegm + 6)->ptO, (testsegm + 6)->ptF);
  86.   (testsegm + 6)->line_ind = 6;
  87.  
  88.   (testsegm + 7)->ptO.x = 96;
  89.   (testsegm + 7)->ptO.y = 216;
  90.   (testsegm + 7)->ptF.x = 162;
  91.   (testsegm + 7)->ptF.y = 216;
  92.   (testsegm + 7)->slope = fslope ((testsegm + 7)->ptO, (testsegm + 7)->ptF);
  93.   (testsegm + 7)->line_ind = 7;
  94.  
  95.   (testsegm + 8)->ptO.x = 96;
  96.   (testsegm + 8)->ptO.y = 246;
  97.   (testsegm + 8)->ptF.x = 162;
  98.   (testsegm + 8)->ptF.y = 246;
  99.   (testsegm + 8)->slope = fslope ((testsegm + 8)->ptO, (testsegm + 8)->ptF);
  100.   (testsegm + 8)->line_ind = 8;
  101.  
  102.   (testsegm + 9)->ptO.x = 85;
  103.   (testsegm + 9)->ptO.y = 272;
  104.   (testsegm + 9)->ptF.x = 155;
  105.   (testsegm + 9)->ptF.y = 272;
  106.   (testsegm + 9)->slope = fslope ((testsegm + 9)->ptO, (testsegm + 9)->ptF);
  107.   (testsegm + 9)->line_ind = 9;
  108.  
  109.   (testsegm + 10)->ptO.x = 78;
  110.   (testsegm + 10)->ptO.y = 298;
  111.   (testsegm + 10)->ptF.x = 148;
  112.   (testsegm + 10)->ptF.y = 298;
  113.   (testsegm + 10)->slope = fslope ((testsegm + 10)->ptO, (testsegm + 10)->ptF);
  114.   (testsegm + 10)->line_ind = 10;
  115.  
  116. }
  117.